home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_218 / edlib / strnicmp.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  573b  |  23 lines

  1. /*
  2.  * edlib v1.1 Copyright 1989 Edwin Hoogerbeets
  3.  * This code is freely redistributable as long as no charge other than
  4.  * reasonable copying fees are levied for it.
  5.  */
  6.  
  7. #include <ctype.h>
  8.  
  9. int strnicmp(str1,str2,len)
  10. register char *str1,*str2;
  11. register int len;
  12. {
  13.     register int index = 0;
  14.  
  15.     while ( str1[index] && str2[index] && index < len - 1 &&
  16.             tolower(str1[index]) == tolower(str2[index]) )
  17.         ++index;
  18.  
  19.     return( (tolower(str1[index]) < tolower(str2[index])) ? -1 :
  20.           ( (tolower(str1[index]) > tolower(str2[index])) ?  1 : 0) );
  21. }
  22.  
  23.